REM @echo off REM - This script searches through each home directory for temporary internet files and deletes them. REM - The script also empties the temp folder REM - THese lines set the starting directory for the script set HDRIVE=c: set HPATH=Documents and Settings %HDRIVE% REM - Clear all Windows Temp files if exist "%HDRIVE%\WINDOWS\Temp" call :WindowsTempDelete if exist "%HDRIVE%\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files" call :ASPNET11TempDelete if exist "%HDRIVE%\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files" call :ASPNET20TempDelete if exist "%HDRIVE%\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files" call :ASPNET2064TempDelete cd \%HPATH% REM - This line sets up the loop for the script for /d %%i in (*) do call :ifthen %%i goto end REM - These lines check for the presence of the temporary internet file directories and call subroutines to deal with them. :ifthen if exist "%HDRIVE%\%HPATH%\%1\Local Settings\Application Data\Microsoft\Terminal Server Client\Cache" call :TempMSTSCCache %1 if exist "%HDRIVE%\%HPATH%\%1\Local Settings\Temporary Internet Files\Content.IE5" call :ContentDelete1 %1 if exist "%HDRIVE%\%HPATH%\%1\windows\Temporary Internet Files\Content.IE5" call :ContentDelete2 %1 if exist "%HDRIVE%\%HPATH%\%1\Local Settings\temp" call :TempDelete %1 goto :EOF REM - This subroutine removes all folders located in the user's "Profile\Local Settings\Temporary Internet Files\Content.IE5" REM - directory (in their home directory). It then returns back to the line that it was called from. :WindowsTempDelete cd "%HDRIVE%\Windows\Temp" if exist "%HDRIVE%\Windows\Temp" for /d %%n in (*) do rd /s /q "%%n" if exist "%HDRIVE%\Windows\Temp" del /q "%HDRIVE%\Windows\Temp\*" goto:EOF :ASPNET11TempDelete cd "%HDRIVE%\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files" if exist "%HDRIVE%\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files" for /d %%n in (*) do rd /s /q "%%n" if exist "%HDRIVE%\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files" del /q "%HDRIVE%\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\*" goto:EOF :ASPNET20TempDelete cd "%HDRIVE%\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files" if exist "%HDRIVE%\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files" for /d %%n in (*) do rd /s /q "%%n" if exist "%HDRIVE%\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files" del /q "%HDRIVE%\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\*" goto:EOF :ASPNET2064TempDelete cd "%HDRIVE%\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files" if exist "%HDRIVE%\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files" for /d %%n in (*) do rd /s /q "%%n" if exist "%HDRIVE%\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files" del /q "%HDRIVE%\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\*" goto:EOF :ContentDelete1 cd "%HDRIVE%\%HPATH%\%1\Local Settings\Temporary Internet Files\Content.IE5" if exist "%HDRIVE%\%HPATH%\%1\Local Settings\Temporary Internet Files\Content.IE5" for /d %%n in (*) do rd /s /q "%%n" if exist "%HDRIVE%\%HPATH%\%1\Local Settings\Temporary Internet Files\Content.IE5" del /q "%HDRIVE%\%HPATH%\%1\Local Settings\Temporary Internet Files\Content.IE5\*" goto :EOF REM - This subroutine removes all folders located in the user's "windows\Temporary Internet Files\Content.IE5" directory located REM - in their home directory. It then removes all subfolders from this directory. :ContentDelete2 cd "%HDRIVE%\%HPATH%\%1\windows\Temporary Internet Files\Content.IE5" if exist "%HDRIVE%\%HPATH%\%1\windows\Temporary Internet Files\Content.IE5" for /d %%n in (*) do rd /s /q "%%n" if exist "%HDRIVE%\%HPATH%\%1\windows\Temporary Internet Files\Content.IE5" del /q "%HDRIVE%\%HPATH%\%1\windows\Temporary Internet Files\Content.IE5\*" goto :EOF REM - This subroutine removes all folders located in the user's "windows\Temporary Internet Files\Content.IE5" directory located REM - in their home directory. It then removes all subfolders from this directory. :TempDelete cd "%HDRIVE%\%HPATH%\%1\Local Settings\Temp" if exist "%HDRIVE%\%HPATH%\%1\Local Settings\Temp" for /d %%n in (*) do rd /s /q "%%n" if exist "%HDRIVE%\%HPATH%\%1\Local Settings\Temp" del /q "%HDRIVE%\%HPATH%\%1\Local Settings\Temp\*" goto :EOF :TempMSTSCCache cd "%HDRIVE%\%HPATH%\%1\Local Settings\Application Data\Microsoft\Terminal Server Client\Cache" if exist "%HDRIVE%\%HPATH%\%1\Local Settings\Application Data\Microsoft\Terminal Server Client\Cache" for /d %%n in (*) do rd /s /q "%%n" if exist "%HDRIVE%\%HPATH%\%1\Local Settings\Application Data\Microsoft\Terminal Server Client\Cache" del /q "%HDRIVE%\%HPATH%\%1\Local Settings\Application Data\Microsoft\Terminal Server Client\Cache\*" goto :EOF :end